.class Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupDispatcher;
.super Ljava/lang/Object;
.source "AbstractGroupableOverlay.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x2
    name = "GroupDispatcher"
.end annotation


# static fields
.field private static final GROUP_RADIUS:D = 20.0


# instance fields
.field mGroupList:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList",
            "<",
            "Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupMapItem;",
            ">;"
        }
    .end annotation
.end field

.field mGroupPool:Ljava/util/LinkedList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/LinkedList",
            "<",
            "Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupMapItem;",
            ">;"
        }
    .end annotation
.end field

.field final synthetic this$0:Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;


# direct methods
.method private constructor <init>(Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;)V
    .locals 1
    .parameter

    .prologue
    .line 370
    iput-object p1, p0, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupDispatcher;->this$0:Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 372
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupDispatcher;->mGroupList:Ljava/util/ArrayList;

    .line 373
    new-instance v0, Ljava/util/LinkedList;

    invoke-direct {v0}, Ljava/util/LinkedList;-><init>()V

    iput-object v0, p0, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupDispatcher;->mGroupPool:Ljava/util/LinkedList;

    return-void
.end method

.method synthetic constructor <init>(Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$1;)V
    .locals 0
    .parameter "x0"
    .parameter "x1"

    .prologue
    .line 370
    invoke-direct {p0, p1}, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupDispatcher;-><init>(Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;)V

    return-void
.end method


# virtual methods
.method public clear()V
    .locals 3

    .prologue
    .line 399
    iget-object v2, p0, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupDispatcher;->mGroupList:Ljava/util/ArrayList;

    invoke-virtual {v2}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v1

    .local v1, i$:Ljava/util/Iterator;
    :goto_0
    invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z

    move-result v2

    if-eqz v2, :cond_0

    invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupMapItem;

    .line 400
    .local v0, g:Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupMapItem;
    invoke-virtual {v0}, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupMapItem;->clear()V

    .line 401
    iget-object v2, p0, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupDispatcher;->mGroupPool:Ljava/util/LinkedList;

    invoke-virtual {v2, v0}, Ljava/util/LinkedList;->add(Ljava/lang/Object;)Z

    goto :goto_0

    .line 403
    .end local v0           #g:Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupMapItem;
    :cond_0
    iget-object v2, p0, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupDispatcher;->mGroupList:Ljava/util/ArrayList;

    invoke-virtual {v2}, Ljava/util/ArrayList;->clear()V

    .line 404
    return-void
.end method

.method public getGroupItem(I)Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupMapItem;
    .locals 1
    .parameter "i"

    .prologue
    .line 411
    iget-object v0, p0, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupDispatcher;->mGroupList:Ljava/util/ArrayList;

    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object p0

    .end local p0
    check-cast p0, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupMapItem;

    return-object p0
.end method

.method public getGroupMapItems()Ljava/util/ArrayList;
    .locals 1
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/ArrayList",
            "<",
            "Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupMapItem;",
            ">;"
        }
    .end annotation

    .prologue
    .line 407
    iget-object v0, p0, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupDispatcher;->mGroupList:Ljava/util/ArrayList;

    return-object v0
.end method

.method public newGroupMapItem()Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupMapItem;
    .locals 2

    .prologue
    .line 415
    iget-object v0, p0, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupDispatcher;->mGroupPool:Ljava/util/LinkedList;

    invoke-virtual {v0}, Ljava/util/LinkedList;->isEmpty()Z

    move-result v0

    if-eqz v0, :cond_0

    .line 416
    new-instance v0, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupMapItem;

    iget-object v1, p0, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupDispatcher;->this$0:Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;

    invoke-direct {v0, v1}, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupMapItem;-><init>(Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;)V

    .line 418
    .end local p0
    :goto_0
    return-object v0

    .restart local p0
    :cond_0
    iget-object v0, p0, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupDispatcher;->mGroupPool:Ljava/util/LinkedList;

    invoke-virtual {v0}, Ljava/util/LinkedList;->poll()Ljava/lang/Object;

    move-result-object p0

    .end local p0
    check-cast p0, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupMapItem;

    move-object v0, p0

    goto :goto_0
.end method

.method public putItem(Lcom/htc/android/footprints/vo/Footprint;)V
    .locals 10
    .parameter "f"

    .prologue
    .line 376
    iget-object v6, p0, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupDispatcher;->this$0:Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;

    #getter for: Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;->mProjection:Lcom/google/android/maps/Projection;
    invoke-static {v6}, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;->access$500(Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;)Lcom/google/android/maps/Projection;

    move-result-object v6

    invoke-virtual {p1}, Lcom/htc/android/footprints/vo/Footprint;->getPoint()Lcom/google/android/maps/GeoPoint;

    move-result-object v7

    iget-object v8, p0, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupDispatcher;->this$0:Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;

    #getter for: Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;->mTempPoint:Landroid/graphics/Point;
    invoke-static {v8}, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;->access$400(Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;)Landroid/graphics/Point;

    move-result-object v8

    invoke-interface {v6, v7, v8}, Lcom/google/android/maps/Projection;->toPixels(Lcom/google/android/maps/GeoPoint;Landroid/graphics/Point;)Landroid/graphics/Point;

    .line 377
    const/4 v5, 0x0

    .line 378
    .local v5, inGroup:Z
    iget-object v6, p0, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupDispatcher;->mGroupList:Ljava/util/ArrayList;

    invoke-virtual {v6}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v4

    .local v4, i$:Ljava/util/Iterator;
    :cond_0
    invoke-interface {v4}, Ljava/util/Iterator;->hasNext()Z

    move-result v6

    if-eqz v6, :cond_1

    invoke-interface {v4}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupMapItem;

    .line 379
    .local v2, g:Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupMapItem;
    iget-object v6, p0, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupDispatcher;->this$0:Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;

    #getter for: Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;->mProjection:Lcom/google/android/maps/Projection;
    invoke-static {v6}, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;->access$500(Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;)Lcom/google/android/maps/Projection;

    move-result-object v6

    invoke-virtual {v2}, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupMapItem;->getPoint()Lcom/google/android/maps/GeoPoint;

    move-result-object v7

    iget-object v8, p0, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupDispatcher;->this$0:Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;

    #getter for: Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;->mTempPoint1:Landroid/graphics/Point;
    invoke-static {v8}, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;->access$600(Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;)Landroid/graphics/Point;

    move-result-object v8

    invoke-interface {v6, v7, v8}, Lcom/google/android/maps/Projection;->toPixels(Lcom/google/android/maps/GeoPoint;Landroid/graphics/Point;)Landroid/graphics/Point;

    .line 380
    iget-object v6, p0, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupDispatcher;->this$0:Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;

    #getter for: Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;->mTempPoint:Landroid/graphics/Point;
    invoke-static {v6}, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;->access$400(Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;)Landroid/graphics/Point;

    move-result-object v6

    iget v6, v6, Landroid/graphics/Point;->x:I

    iget-object v7, p0, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupDispatcher;->this$0:Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;

    #getter for: Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;->mTempPoint1:Landroid/graphics/Point;
    invoke-static {v7}, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;->access$600(Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;)Landroid/graphics/Point;

    move-result-object v7

    iget v7, v7, Landroid/graphics/Point;->x:I

    sub-int/2addr v6, v7

    int-to-double v6, v6

    iget-object v8, p0, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupDispatcher;->this$0:Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;

    #getter for: Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;->mTempPoint:Landroid/graphics/Point;
    invoke-static {v8}, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;->access$400(Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;)Landroid/graphics/Point;

    move-result-object v8

    iget v8, v8, Landroid/graphics/Point;->y:I

    iget-object v9, p0, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupDispatcher;->this$0:Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;

    #getter for: Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;->mTempPoint1:Landroid/graphics/Point;
    invoke-static {v9}, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;->access$600(Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;)Landroid/graphics/Point;

    move-result-object v9

    iget v9, v9, Landroid/graphics/Point;->y:I

    sub-int/2addr v8, v9

    int-to-double v8, v8

    invoke-static {v6, v7, v8, v9}, Ljava/lang/Math;->hypot(DD)D

    move-result-wide v0

    .line 382
    .local v0, distance:D
    const-wide/high16 v6, 0x4034

    cmpg-double v6, v0, v6

    if-gez v6, :cond_0

    .line 383
    invoke-virtual {v2, p1}, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupMapItem;->addMapItem(Lcom/htc/android/footprints/vo/Footprint;)V

    .line 384
    const/4 v5, 0x1

    .line 389
    .end local v0           #distance:D
    .end local v2           #g:Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupMapItem;
    :cond_1
    if-nez v5, :cond_2

    .line 390
    iget-object v6, p0, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupDispatcher;->this$0:Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;

    #getter for: Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;->mGroupDispatcher:Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupDispatcher;
    invoke-static {v6}, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;->access$700(Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay;)Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupDispatcher;

    move-result-object v6

    invoke-virtual {v6}, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupDispatcher;->newGroupMapItem()Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupMapItem;

    move-result-object v3

    .line 391
    .local v3, gm:Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupMapItem;
    invoke-virtual {v3, p1}, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupMapItem;->addMapItem(Lcom/htc/android/footprints/vo/Footprint;)V

    .line 392
    iget-object v6, p0, Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupDispatcher;->mGroupList:Ljava/util/ArrayList;

    invoke-virtual {v6, v3}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 396
    .end local v3           #gm:Lcom/htc/android/footprints/overlay/AbstractGroupableOverlay$GroupMapItem;
    :cond_2
    return-void
.end method
